package com.apes.fn.scm.retailOrder.model;

import com.apes.framework.jpa.BaseModel;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.framework.util.ApesConst;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * 零售单扩展类
 * @author wuq
 * @Time 2022-5-19 17:52
 * @Description
 */
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = RetailOrderExtension.CONST_TABLE_NAME)
public class RetailOrderExtension extends BaseModel {
    public static final String CONST_TABLE_NAME = "Retail_Order_Extension";

    @Id
    @Column(name = "id", length = 32)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "零售单扩展表")
    @Comment("零售单扩展表单号")
    private long id;

    @Column(name = "retail_Order_Id", length = 30)
    @Comment("零售单号")
    private String retailOrderId;

    @Column(name = "retail_Order_Item_Id", length = 30)
    @Comment("零售单明细号")
    private String retailOrderItemId;

    /* 公司、部门相关 */
    @Column(name = "company_name", length = 30)
    @Comment("公司名称")
    private String companyName;

    @Column(name = "dept_name", length = 30)
    @Comment("部门名称")
    private String deptName;

    @Column(name = "service_dept_name", length = 30)
    @Comment("服务部门名称")
    private String serviceDeptName;

    @Column(name = "OPERATION", length = 16)
    @Comment("运营模式编码")
    private String operation;

    @Column(name = "OPERATION_NAME", length = 30)
    @Comment("运营模式")
    private String operationName;

    @Column(name = "MAKE_INVOICE_NAME", length = 30)
    @Comment("开票公司名称")
    private String makeInvoiceName;

    /* 商品相关 */
    @Column(name = "product_name", length = 100)
    @Comment("商品名称")
    private String productName;

    @Column(name = "product_classify", length = 100)
    @Comment("商品分类")
    private String productClassify;

    @Column(name = "product_classify_id", length = 100)
    @Comment("商品分类编码")
    private String productClassifyId;

    @Column(name = "product_group_ID", length = 100)
    @Comment("商品组编码")
    private String productGroupId;

    @Column(name = "product_group_name", length = 100)
    @Comment("商品组名称")
    private String productGroupName;

    @Column(name = "category_id", length = 100)
    @Comment("商品类目")
    private String categoryId;

    @Column(name = "category_name", length = 100)
    @Comment("商品类目名称")
    private String categoryName;

    @Column(name = "brand_id", length = 16)
    @Comment("品牌编码")
    private String brandId;

    @Column(name = "brand_name", length = 100)
    @Comment("品牌名称")
    private String brandName;

    @Column(name = "product_state", length = 10)
    @Comment("商品状态")
    private String productState;

    @Column(name = "serve_type_id", length = 10)
    @Comment("服务类型编码")
    private String serveTypeId;

    @Column(name = "serve_type_name", length = 10)
    @Comment("服务类型")
    private String serveTypeName;

    @Column(name = "uom_name", length = 10)
    @Comment("计量单位名称")
    private String uomName;

    @Column(name = "tax_name", length = 10)
    @Comment("税率")
    private String taxName;

    /* 车辆信息相关 */
    @Column(name = "car_license", length = 64)
    @Comment("车牌号码")
    private String carLicense;

    @Column(name = "realname", length = 32)
    @Comment("客户名称")
    private String realname;

    @Column(name = "mobile", length = 32)
    @Comment("客户手机号")
    private String mobile;

    @Column(name = "unit_client_id", length = 64)
    @Comment("单位会员编码")
    private String unitClientId;

    @Column(name = "unit_client_name", length = 64)
    @Comment("单位会员名称")
    private String unitClientName;

    /* 折扣明细金额相关 */
    @Comment("折扣总金额")
    @Column(name = "retail_Discount_Amount", nullable = false, columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    private double retailDiscountAmount;

    @Comment("折扣红包金额")
    @Column(name = "red_envelope_cash", nullable = false, columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    private double redEnvelopeCash;

    @Comment("保呗红包金额")
    @Column(name = "baobei_Envelope_Cash", nullable = false, columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    private double baobeiEnvelopeCash;

    @Comment("年卡兑换券金额")
    @Column(name = "coupon_Discount_Amount", nullable = false, columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    private double couponDiscountAmount;

    @Comment("卡券折扣金额")
    @Column(name = "ticket_Discount_Amount", nullable = false, columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    private double ticketDiscountAmount;

    @Comment("异业折扣金额")
    @Column(name = "cross_Discount_Amount", nullable = false, columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    private double crossDiscountAmount;

    @Comment("收银台折扣金额")
    @Column(name = "cashier_Desk_Discount_Amount", nullable = false, columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    private double cashierDeskDiscountAmount;
}
